<?php

/**
*	版块删除和恢复 (物理删除) 
*
*/

//包含公共文件
include '../../common/common.php';

//接收get传值,用于确定版块
// var_dump($_POST);

$replyBtn2 = $_POST['replyBtn2'];
$arrReply2 = $_POST['arrReply2'];
$strReply2 = join(',' , $arrReply2);

// var_dump($strReply2);

//判断选项是否为空
if (!$arrReply2) {

	exit('选项不得为空 <a href="'  . $_SERVER['HTTP_REFERER'] .'">返回上一页</a>');
}

//删除
if ($replyBtn2 == '删 除') {

	//删除数据
	$delReply = myDelete($link , DB_TABLE_DETAIL , "id in ($strReply2)");
	// var_dump($delReply);

	//判断结果集
	if (!$delReply) {

		exit('删除失败');
	}

	//跳转页面
	echo '删除成功';
	header('refresh:1;url=' . $_SERVER['HTTP_REFERER']);
}

//恢复
if ($replyBtn2 == '恢 复') {

	//修改数据库
	$updateReply = myUpdate($link , DB_TABLE_DETAIL , ['isdel' => 0] , "id in ($strReply2
		)");
	// var_dump($updateReply);

	//判断结果集
	if (!$updateReply) {
		exit('恢复失败 <a href="'  . $_SERVER['HTTP_REFERER'] .'">返回上一页</a>');
	}

	//跳转页面
	echo '恢复成功';
	header('refresh:1;url=' . $_SERVER['HTTP_REFERER']);

}